#include "decoratorsType.h"
#include "IVisitor.h"

decoratorsType::decoratorsType(const exprTypePtr& func, const ExprTypeList& args, const KeywordTypeList& keywords, const exprTypePtr& starargs, const exprTypePtr& kwargs, int nodeId):
    SimpleNode(nodeId),
    _func(func),
    _args(args),
    _keywords(keywords),
    _starargs(starargs),
    _kwargs(kwargs)
{
}
    
decoratorsType::~decoratorsType()
{
    _args.clear();_keywords.clear();
}
    
Ast::AstTypes decoratorsType::type() const
{
    return Ast::decoratorsType;
}
    

exprTypePtr decoratorsType::func()
{
    return _func;
}

void decoratorsType::setFunc(const exprTypePtr& func)
{
    _func = func;
}

ExprTypeList decoratorsType::args()
{
    return _args;
}

void decoratorsType::setArgs(const ExprTypeList& args)
{
    _args = args;
}

KeywordTypeList decoratorsType::keywords()
{
    return _keywords;
}

void decoratorsType::setKeywords(const KeywordTypeList& keywords)
{
    _keywords = keywords;
}

exprTypePtr decoratorsType::starargs()
{
    return _starargs;
}

void decoratorsType::setStarargs(const exprTypePtr& starargs)
{
    _starargs = starargs;
}

exprTypePtr decoratorsType::kwargs()
{
    return _kwargs;
}

void decoratorsType::setKwargs(const exprTypePtr& kwargs)
{
    _kwargs = kwargs;
}

    
QString decoratorsType::toString() const
{
    return QString("decoratorsType[func=%1, args=%2, keywords=%3, starargs=%4, kwargs=%5]").
                arg(_func ? _func->toString():"").
                arg(_args.toString()).
                arg(_keywords.toString()).
                arg(_starargs ? _starargs->toString():"").
                arg(_kwargs ? _kwargs->toString():"");
}
    
void decoratorsType::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    traverse(visitor);
}
    
void decoratorsType::traverse(IVisitor* visitor)
{
    if (_func != NULL)
        _func->accept(visitor, _func);
    _args.traverse(visitor);
    _keywords.traverse(visitor);
    if (_starargs != NULL)
        _starargs->accept(visitor, _starargs);
    if (_kwargs != NULL)
        _kwargs->accept(visitor, _kwargs);
}